package com.zy.teacherSide.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zy.teacherSide.entity.Teacher;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Component;

/**
 * @author CR
 */
@Mapper
@Component
public interface TeacherDao extends BaseMapper<Teacher> {

    /**
     * 根据教师的编号和密码进行查询
     * @param teacherNum
     * @param teacherPassword
     * @return Teacher
     */
    @Select("select * from hms_teacher where teacher_num=#{teacherNum} and teacher_password=#{teacherPassword}")
    Teacher teacherLogin(Integer teacherNum,String teacherPassword);

    /**
     * 根据教师teacher_num查重
     * @param teacherNum
     * @return Teacher
     */
    @Select("select * from hms_teacher where teacher_num=#{teacherNum}")
    Teacher getTeacherById(Integer teacherNum);

    /**
     * 根据教师teacher_id查重
     * @param teacherId
     * @return Teacher
     */
    @Select("select * from hms_teacher where teacher_id=#{teacherId}")
    Teacher getTeacherByTeacherId(Integer teacherId);

    /**
     * 更新教师权限
     * @param shiro
     * @param teacherId
     * @return Boolean
     */
    @Update("update hms_teacher set teacher_shiro=#{shiro} where teacher_id=#{teacherId}")
    Boolean updateTeacher(Integer shiro,Integer teacherId);
}
